<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>添加课程</title>

    <script src="${pageContext.request.contextPath}/js/jquery-1.12.4.min.js"></script>
	<script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
	<script src="${pageContext.request.contextPath}/js/confirm.js"></script>
	<script src="${pageContext.request.contextPath}/js/jquery.validate.min.js"></script>
	<script src="${pageContext.request.contextPath}/js/message_cn.js"></script>
	<link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet">
  </head>
  <body>
    
    <nav class="navbar navbar-inverse" style="margin-bottom:0px;">
     <div class="container">
     
      <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
          
          <a class="navbar-brand" href="videoList.action">视频管理项目</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-9">
          <ul class="nav navbar-nav">
            <li ><a href="videoList.action">视频管理</a></li>
            <li><a href="speakerList.action">主讲人管理</a></li>
            <li class="active"><a href="courseList.action">课程管理</a></li>
          </ul>
          
          <p class="navbar-text navbar-right"><span>${sessionScope.userName}</span><i class="glyphicon glyphicon-log-in"></i>
            <a href="${pageContext.request.contextPath}/admin/exit.action" class="navbar-link">退出</a>
          </p>
        </div><!-- /.navbar-collapse -->
       </div>
      </div><!-- /.container-fluid -->
    </nav>
    <div class="jumbotron" style="margin-top:0px;padding-top:7px;padding-bottom:7px;">
	    <div class="container" >
	       <c:if test="${empty course.id}">
	       <h2>添加课程</h2>
	    </c:if>
	    <c:if test="${not empty course.id}">
	    	<h2>修改课程</h2>
	    </c:if>
	    </div>
	</div>
	
	<div class="container">
	     <form class="form-horizontal" action="saveOrUpdateCourse.action" method="post">
			  <input type="hidden" name="id" value="${course.id }">
			  <div class="form-group">
			    <label for="inputEmail3" class="col-sm-2 control-label">所属学科</label>
			    <div class="col-sm-10">
			      <select class="form-control" name="subjectId">
					<option value="0">请选择所属学科</option>
					<c:forEach items="${subjectList }" var="cou" varStatus="statu">
						<option value="${cou.id }"
							<c:if test="${course.subjectId==cou.id}">selected</c:if>
						>${cou.subjectName }</option>
					</c:forEach>
				  </select>
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="inputPassword3" class="col-sm-2 control-label">标题</label>
			    <div class="col-sm-10">
			      <input type="text" class="form-control" id="inputPassword3" placeholder="课程标题" name="courseTitle" value="${course.courseTitle }">
			    </div>
			  </div>
			  <div class="form-group">
			    <label for="inputPassword3" class="col-sm-2 control-label">简介</label>
			    <div class="col-sm-10">
			      <textarea class="form-control" rows="3" name="courseDesc">${course.courseDesc }</textarea>
			    </div>
			  </div>
			  
			  <div class="form-group">
			    <div class="col-sm-offset-2 col-sm-10">
			      <button type="submit" class="btn btn-default">保存</button>
			    </div>
			  </div>
			</form> 
	</div>
  </body>
</html>